package com.chezhujie.www.enums;

import com.chezhujie.www.core.init.mysql.annotation.Enum;

/**
 * 订单状态
 * Created by 汤伟杰 on 2017/6/1.
 */
@Enum(name="orderstatus",type = "select")
public enum OrderStatus {

    UNSTART("未开始",3),UNUSE("未使用",4),USE("已使用",5),OUTOFDATE("已过期",6),//活动
    RUNNING("待支付",0),SUCCESS("支付成功",1),FAIL("支付失败",2),
    WAITFORRECEIVING("待收货",7),FIN("已完成",8),CLOSE("已关闭",9),
    //待发货的退款->取消订单中->订单已取消
    CANSEL("取消订单中",10),REFUNDED("订单已取消",17),
    RECEIVED("已领取",11),UNRECEIVED("未领取",12),//奖品
    TOSENDGOODS("待发货",13),REFUNDFAIL("退款失败",14),
    //确认收货的退款->申请退货->退货成功（商家确认）
    REFUNDING("申请退货",16),REFUNDSUCCESS("退货退款成功",18)
    //待支付是取消订单
    ,CANSELORDER("订单已取消",19)
    ;
    private String name;
    private int index;
    // 构造方法
    private OrderStatus(String name, int index) {
        this.name = name;
        this.index = index;
    }
    // 普通方法
    public static String getName(int index) {
        for (OrderStatus c : OrderStatus.values()) {
            if (c.getIndex() == index) {
                return c.name;
            }
        }
        return null;
    }
    // get set 方法
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getIndex() {
        return index;
    }
    public void setIndex(int index) {
        this.index = index;
    }
}
